#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int d[N];
ll c[155][155];
void init(int n) {
  rep(i, 0, n) c[i][0] = 1;
  rep(i, 1, n) rep(j, 1, i) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  init(150);
  rep(i, 1, n) cin >> d[i];
  ll sum = accumulate(d + 1, d + n + 1, 0ll);
  if (sum != 2 * (n - 1)) {
    cout << 0;
    return 0;
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  ll ans = 1;
  ll cnt = n - 2;
  rep(i, 1, n) {
    ans *= c[cnt][d[i] - 1];
    cnt -= d[i] - 1;
  }

  cout << ans;
  return 0;
}